package cn.xopencode.recordservice.manager.roomin;

import cn.xopencode.common.framework.vo.PageResult;
import cn.xopencode.recordservice.convert.roomin.RoomInRecordConvert;
import cn.xopencode.recordservice.rpc.roomin.dto.*;
import cn.xopencode.recordservice.rpc.roomin.vo.RoomInRecordPageVO;
import cn.xopencode.recordservice.rpc.roomin.vo.RoomInRecordUpdateVO;
import cn.xopencode.recordservice.service.roomin.RoomInRecordService;
import cn.xopencode.recordservice.service.roomin.bo.RoomInRecordCreateBO;
import cn.xopencode.recordservice.service.roomin.bo.RoomInRecordUpdateBO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RoomInRecordManager {

    @Autowired
    private RoomInRecordService roomInRecordService;

    public PageResult<RoomInRecordPageVO> pageRoomInRecord(RoomInRecordPageDTO pageDTO){
        return roomInRecordService.pageRoomInRecord(RoomInRecordConvert.INSTANCE.convert(pageDTO));
    }

    public RoomInRecordUpdateVO getRoomInRecordById(String id){
        return roomInRecordService.getRoomInRecordById(id);
    }

    public Integer createRoomInRecord(RoomInRecordCreateDTO createDTO){
        RoomInRecordCreateBO createBO = RoomInRecordConvert.INSTANCE.convert(createDTO);
        return roomInRecordService.createRoomInRecord(createBO, createDTO.getEmpIds());
    }

    public Integer updateRoomInRecord(RoomInRecordUpdateDTO updateDTO){
        RoomInRecordUpdateBO updateBO = RoomInRecordConvert.INSTANCE.convert(updateDTO);
        return roomInRecordService.updateRoomInRecord(updateBO, updateDTO.getEmpIds());
    }

    public PageResult<AdminRoomInRecordVO> getAdminPageRoomInRecord(AdminRoomInRecordDTO pageDTO) {
        return roomInRecordService.getAdminPageRoomInRecord(RoomInRecordConvert.INSTANCE.convert(pageDTO));
    }
    
}
